
/*
 * $HeadURL: http://catwork.googlecode.com/svn/trunk/root/static/js/catwork/core/messages.js $
 * $Id: messages.js 2 2011-03-20 16:14:09Z hg.winkler.77 $
*/


function show_infos(HEADER, MESSAGE) {

    var info_message = "";
    for (var i=0; i < MESSAGE.length; i++) {
        info_message += "<p style='line-height: 15px !important;'><span style='float: left; margin-right: 0.3em;' class='ui-icon ui-icon-lightbulb'></span>"+MESSAGE[i]+"</p>";
    }
    
    if(info_message != "") {
        $("#infos").append("<div style='margin-bottom:5px; font-weight:bold;'>"+HEADER+"</div>"+info_message);
        $("#infos").fadeIn('slow');
        $('#infos').animate({opacity: 1.0}, 5000).fadeOut('slow');
    } 

}

function remove_infos() {

    $("#infos").hide();
    $("#infos").empty();

}

function show_warnings(HEADER, MESSAGE) {

    var warning_message = "";
    for (var i=0; i < MESSAGE.length; i++) {
        warning_message += "<p style='line-height: 15px !important;'><span style='float: left; margin-right: 0.3em;' class='ui-icon ui-icon-info'></span>"+MESSAGE[i]+"</p>";
    }
    
    if(warning_message != "") {
        $("#warnings").append("<div style='margin-bottom:5px; font-weight:bold;'>"+HEADER+"</div>"+warning_message);
        $("#warnings").fadeIn('slow');
    } 

}

function remove_warnings() {

    $("#warnings").hide();
    $("#warnings").empty();

}

function show_errors(HEADER, MESSAGE) {

    var error_message = "";
    for (var i=0; i < MESSAGE.length; i++) {
        error_message += "<p style='line-height: 15px !important;'><span style='float: left; margin-right: 0.3em;' class='ui-icon ui-icon-alert'></span>"+MESSAGE[i]+"</p>";
    }
    
    if(error_message != "") {
        $("#errors").append("<div style='margin-bottom:5px; font-weight:bold;'>"+HEADER+"</div>"+error_message);
        $("#errors").fadeIn('slow');
    } 

}

function remove_errors() {

    $("#errors").hide();
    $("#errors").empty();

}
